﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Security;


namespace Business
{
    public class Tools
    {
        
        public static string AdSoyad(MembershipUser Kullanici)
        {
            DbEntities db = new DbEntities();
            Guid KID = (Guid)Kullanici.ProviderUserKey;
            if (Roles.IsUserInRole(Kullanici.UserName, "OgrenciIsleri"))
            {
                return db.tblOgrIsleriDetaylaris.Where(o => o.UserId == KID).SingleOrDefault().AdSoyad;
            }
            else if (Roles.IsUserInRole(Kullanici.UserName, "Akademisyen"))
            {
                return db.tblAkademisyenDetaylaris.Where(o => o.UserId == KID).SingleOrDefault().AdSoyad;
            }
            else
            {
                return db.tblUyeDetaylaris.Where(o => o.UserId == KID).SingleOrDefault().AdSoyad;
            }
            return "";
        }
        public static string AdSoyad(string KullaniciID)
        {
            DbEntities db = new DbEntities();
            Guid KID = Guid.Parse(KullaniciID);
            MembershipUser Kullanici = Membership.GetUser(KID);
            if (Roles.IsUserInRole(Kullanici.UserName, "OgrenciIsleri"))
            {
                return db.tblOgrIsleriDetaylaris.Where(o => o.UserId == KID).SingleOrDefault().AdSoyad;
            }
            else if (Roles.IsUserInRole(Kullanici.UserName, "Akademisyen"))
            {
                return db.tblAkademisyenDetaylaris.Where(o => o.UserId == KID).SingleOrDefault().AdSoyad;
            }
            else
            {
                return db.tblUyeDetaylaris.Where(o => o.UserId == KID).SingleOrDefault().AdSoyad;
            }
            return "";
        }
        public static string HaftaninGunleri(int Gun)
        {
            switch (Gun)
            {
                case 1: return "Pazartesi"; break;
                case 2: return "Salı"; break;
                case 3: return "Çarşamba"; break;
                case 4: return "Perşembe"; break;
                case 5: return "Cuma"; break;
                default: return "";
            }
        }
    }
}
